package com.sixth.controller;

import com.sixth.entity.BusCustomer;
import com.sixth.entity.RoleMenuKey;
import com.sixth.service.BusCustomerService;
import com.sixth.util.CommonResult;
import com.sixth.util.TableLayUi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @program: carrent
 * @description:
 * @author: 老范
 * @create: 2022-01-12 17:15
 **/
@RestController
@RequestMapping("Role")
@ResponseBody
public class BusCustomerController {
    @Autowired
    private BusCustomerService busCustomerService;
    @RequestMapping("findAll")//查询全部
    public TableLayUi list(int page,int limit){
        return busCustomerService.findBusCustomer(page,limit);
    }

//    @RequestMapping("addOrUpdate")
//    public CommonResult addOrUpdate(BusCustomer busCustomer){
//        System.out.println(busCustomer);
//        return busCustomerService.addOrUpdate(busCustomer);
//    }

    @RequestMapping("listByCondition")
    public TableLayUi listByCondition(int page,int limit,String identity,String custname,String phone,String address,String career,Integer sex){
        return busCustomerService.listByCondition(page,limit,identity,custname,phone,address,career,sex);
    }
    @RequestMapping("add")
    public  CommonResult add(String identity, String custname, String phone, String address, String career, Integer sex, Date createtime){

        //System.out.println("identity"+identity+ "custname"+custname+ "phone"+phone+ "address"+address+ "career"+career+ "sex"+sex+ "createtime"+createtime);
        return busCustomerService.add(identity, custname, phone, address, career, sex, createtime);
    }

    @RequestMapping("update")
    public  CommonResult update(BusCustomer busCustomer){
         return busCustomerService.update(busCustomer);
    }


    @RequestMapping("delete")
    public CommonResult delete(String identity){
        return busCustomerService.delete(identity);
    }

    @RequestMapping("dels")
    public CommonResult dels(String identity){
        return busCustomerService.batch(identity);
    }
}
